#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>

#include <stdio.h>

int main()
{
    int year = 0;
    int month = 0;
    int day = 0;
    int count = 0;
    scanf("%d %d %d", &year, &month, &day);
    switch (month)
    {
    case 1:
    {
        count += day;
        break;
    }
    case 2:
    {
        count += 31 + day;
        break;
    }
    case 3:
    {
        count += 31 + 28 + day;
        break;
    }
    case 4:
    {
        count += 31 + 28 + 31 + day;
        break;
    }
    case 5:
    {
        count += 31 + 28 + 31 + 30 + day;
        break;
    }
    case 6:
    {
        count += 31 + 28 + 31 + 30 + 31 + day;
        break;
    }
    case 7:
    {
        count += 31 + 28 + 31 + 30 + 31 + 30 + day;
        break;
    }
    case 8:
    {
        count += 31 + 28 + 31 + 30 + 31 + 30 + 31 + day;
        break;
    }
    case 9:
    {
        count += 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + day;
        break;
    }
    case 10:
    {
        count += 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + day;
        break;
    }
    case 11:
    {
        count += 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + day;
        break;
    }
    case 12:
    {
        count += 31 + 28 + 31 + 30 + 31 + 30 + 31 + 31 + 30 + 31 + 30 + day;
        break;
    }
    }
    if ((((year % 4 == 0) && (year % 100 != 0)) || (year % 400 == 0)) && (month > 2))
        count++;
    printf("%d", count);
    return 0;
}